#include "../myOS/userInterface.h" //interface from kernel

#include "shell.h"
#include "memTestCase.h"
#include "../myOS/include/mem.h"
#include "../myOS/include/task.h"

void wallClock_hook_main(void)
{
	int _h, _m, _s;
	char hhmmss[] = "hh:mm:ss\0\0\0\0";

	getWallClock(&_h, &_m, &_s);
	sprintf(hhmmss, "%02d:%02d:%02d", _h, _m, _s);
	put_chars(hhmmss, 0x30, 24, 72);
}

void doSomeTestBefore(void)
{
	setWallClock(10, 40, 00); // set time 18:59:59
	setWallClockHook(&wallClock_hook_main);
}

extern void testcase0(void);
extern void testcase1(void);
extern void testcase2(void);
extern void shell(void);

void myMain(void)
{

#if DEBUG_QUEUE_FALGS
	myPrintf(0x08, "\nPress any key to continue debug:\n");
	uart_get_char();
#endif

	doSomeTestBefore();

	initShell();

	int shellTid = createTsk(shell);
	int testtid0 = createTsk(testcase0);
	int testtid1 = createTsk(testcase1);
	int testtid2 = createTsk(testcase2);

	tskStart(testtid0);
	// printFreeQueue();
	tskStart(testtid1);
	// printFreeQueue();
	tskStart(testtid2);
	// printFreeQueue();
	tskStart(shellTid);
	// printFreeQueue();

#if DEBUG_QUEUE_FALGS
	myPrintf(0x08, "\nPress any key to continue debug:\n");
	uart_get_char();
#endif

	return;
}
